Skip to content

Allow comment deletion via nested attributes#1358

Merged
maebeale merged 2 commits intomainfrom
maebeale/comment-delete-ahoy-log
Mar 9, 2026
Merged

Allow comment deletion via nested attributes#1358
maebeale merged 2 commits intomainfrom
maebeale/comment-delete-ahoy-log

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 7, 2026

What is the goal of this PR and why is this important?

  • Comments on Person, User, Organization, and EventRegistration records could not be deleted
  • Adds the ability to remove comments from the nested form on edit pages

How did you approach the change?

  • Added allow_destroy: true to accepts_nested_attributes_for :comments on all 4 commentable models
  • Permitted :_destroy in comments_attributes strong params in People, Users, and Organizations controllers (EventRegistrations already had it)
  • Added a cocoon "Remove" link to the _comment_fields.html.erb partial, matching the style used for affiliations

UI Testing Checklist

  • Edit a person and verify "Remove" link appears on existing comments
  • Click "Remove" on a comment, save the form, and verify the comment is deleted
  • Verify the same works on person, user, organization, and event registration edit pages

🤖 Generated with Claude Code

maebeale and others added 2 commits March 7, 2026 06:53
Enable allow_destroy on accepts_nested_attributes_for :comments
across all commentable models (Person, User, Organization,
EventRegistration) and permit :_destroy in their controllers.
Adds a "Remove" link to the comment fields partial.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale merged commit 7ac3141 into main Mar 9, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/comment-delete-ahoy-log branch March 9, 2026 14:17
maebeale added a commit that referenced this pull request Mar 9, 2026
* Allow comment deletion via nested attributes

Enable allow_destroy on accepts_nested_attributes_for :comments
across all commentable models (Person, User, Organization,
EventRegistration) and permit :_destroy in their controllers.
Adds a "Remove" link to the comment fields partial.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Show Remove button only in comment edit mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant